<#include "../studentNavigation/index.html">
<#if message?exists>
	${message}
</#if>


 <script src="//cdn.bootcss.com/bootstrap-validator/0.5.3/js/bootstrapValidator.js"></script>
 <link href="//cdn.bootcss.com/bootstrap-validator/0.5.3/css/bootstrapValidator.min.css" rel="stylesheet" />
				<div class="main-content">
						<div class="breadcrumbs" id="breadcrumbs">
							<script type="text/javascript">
								try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
							</script>
	
							<ul class="breadcrumb">
								<li>
									<i class="icon-home home-icon"></i>
									<a href="${contextPath}/student/index">教学日历服务平台教师首页</a>
								</li>
								<li class="active">课程列表</li>
							</ul><!-- .breadcrumb -->
						</div>
                   <div class="page-content">
                   
	        	          <div class="page-header" style="padding-bottom:45px;">
									
							  <label>学期</label>
						       <br> 
						       <select id="year" name="year"
										class="form-control"  onchange="change(this)" style="width:50%;"><#if
										listAll??> <#list listAll as mn><option value="${mn}">${mn}</option> </#list> </#if>
								
							  </select> 
							</div><!-- /.page-header -->
        
                   	<div class="row">
							<div class="col-xs-12">
							

							<table style="font-size:17px;" cellspacing="0" cellpadding="0">
      							<tr>
        							<th>我的课程</th>
        							<th>课程开始日</th>
        							<th>课程结束日</th>
        							<th>每周学习日</th>
        							<th>授课教师</th>
        							<th>提纲下载</th>
     							</tr>
     						<tbody id="tbody">
      								
      								</tbody>
    						</table>		
    			      </div><!-- /.col-xs-12 -->				 
					</div><!-- /.rowr -->	
               
				   </div><!-- /.page-content -->
				  
				
				      <script id="template" type="html/template">
                                   <tr>
      									<td id="courseName"></td>
      									<td id="courseStart"></td>
      									<td id="courseEnd"></td>
      									<td id="courseDay"></td>
      									<td id="teacherName"></td>
      									<td id="download"></td>
      								</tr>
                      </script>
				   	<script type="text/javascript">
				  //yan:这个js不能移动
	
				   	
					function change(obj)
					{ 
                     var year = obj.value;
						$.ajax({
							type:"post",				
							url:"${contextPath}/student/findCourseRecordByYear",
							data:{year:year}, 
							dataType:  "json", 
							error:function(err){alert(err);},
							success:function loadAd(data)
							{   
								
								$("#tbody").empty();
								for(var i = data.length - 1; i >= 0; i--){
									
									let dataSource = data[i];
									//alert(JSON.stringify(dataSource));
									let pkCourse= dataSource["pkCourse"];
									let courseName = dataSource["courseName"];
									let courseStart = dataSource["courseStart"];
									let courseEnd= dataSource["courseEnd"];
									let courseDay= dataSource["courseDay"];
								
									let teacherName=dataSource["teacherName"]; 
								
									let temp = $("#template").html();							
									let tr = $(temp);
									
									let classname = tr.find("#courseName");
									let classstart = tr.find("#courseStart");
									let classend= tr.find("#courseEnd");
									let classday = tr.find("#courseDay");
									let teachername=tr.find("#teacherName");
									let download = tr.find("#download");
								
									classname.text(courseName);
									classstart.text(courseStart);
									classend.text(courseEnd);
									classday.text(courseDay);
									teachername.text(teacherName);
									download.html("<a href='${contextPath}/student/courseManage/download?pkCourse="+pkCourse+"'>下载</a>");
									//这个是一个典型的传参数方法，？后面加值，然后在Spring中就是在control里面加注解@RequestParam
									$("#tbody").append(tr);	
									
								}	
	
							},
						});
						
						
					}
				   	
					 </script > 	
  
		</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->

		